import { Http } from "../utils/http";

class Subscribe extends Http {
  constructor(props) {
    super(props);
  }

  //之前的提交申请
  addSubscribe(ownerName, ownerPhone, commid, visitorName, remark) {
    return this.request({
      url: "/mini/miniReserveRecord/add",
      method: "put",
      data: {
        ownerName,
        ownerPhone,
        commid,
        visitorName,
        remark,
      },
    });
  }
  //我的预约
  subscribeList(pageNo = 1, pageSize = 10, type = 0) {
    return this.request({
      url: "/mini/miniReserveRecord/appVisitorlist",
      method: "get",
      data: {
        type,
        pageNo,
        pageSize,
      },
    });
  }

  //邀约访客列表
  miniVisitorList(params) {
    return this.request({
      url: "/mini/miniVisitor/list",
      method: "get",
      data: params,
    });
  }

  // 邀约访客--新增邀约--我的地址下拉框
  miniVisitorGetAddress(params) {
    return this.request({
      url: "/mini/miniVisitor/getAddress",
      method: "get",
      data: params,
    });
  }

  // 邀约访客--新增邀约（添加）
  miniVisitorAdd(data) {
    return this.request({
      url: "/mini/miniVisitor/add",
      method: "post",
      data: data,
    });
  }

  // 邀约访客--新增邀约--详情
  miniVisitorQueryById(params) {
    return this.request({
      url: "/mini/miniVisitor/queryById",
      method: "get",
      data: params,
    });
  }

  //我的审核
  auditList(pageNo = 1, pageSize = 10, type = 0) {
    return this.request({
      url: "/mini/miniReserveRecord/appOwnerlist",
      method: "get",
      data: {
        type,
        pageNo,
        pageSize,
      },
    });
  }

  //获取业主小区
  getOwnerCommunity(phone) {
    return this.request({
      // url: "/app/reserverecord/getCommunity",
      url: "/mini/miniReserveRecord/getCommunityByPhone",
      method: "get",
      data: {
        phone,
      },
    });
  }

  //获取审核详情
  auditListById(id) {
    return this.request({
      url: "/mini/miniReserveRecord/appReserveRecordById",
      data: {
        id,
      },
    });
  }

  //处理审核
  auditProcess(id, status) {
    return this.request({
      url: "/mini/miniReserveRecord/checkReserve",
      method: "post",
      data: {
        id,
        status,
      },
    });
  }

  //获取红点状态
  subscribeGetRed() {
    return this.request({
      url: "/mini/miniReserveRecord/getRed",
    });
  }

  //获取业主小区 --改
  getCommunityList(phone, commName) {
    return this.request({
      // url: "/app/reserverecord/getCommunity",
      url: "/mini/miniReserveRecord/getCommunityByPhone",
      method: "get",
      data: {
        phone,
        commName,
      },
    });
  }
  //获取关系/事由/时间
  getDictItem(id) {
    return this.request({
      url: `/sys/dict/getDictItems/${id}`,
      method: "get",
    });
  }
  //之前的提交申请
  putSubscribe(
    ownerName,
    ownerPhone,
    commid,
    visitorName,
    remark,
    visitorIdCard,
    editVisitorPhone,
    visitorRelation,
    visitorOpenTime
  ) {
    return this.request({
      url: "/mini/miniReserveRecord/add",
      method: "put",
      data: {
        ownerName,
        ownerPhone,
        commid,
        visitorName,
        remark,
        visitorIdCard,
        editVisitorPhone,
        visitorRelation,
        visitorOpenTime,
      },
    });
  }
}

export { Subscribe };
